# 函数
def doSomething():
    return "1", 2, [3, 4]


def doNothing():
    return


result = doSomething()
print(result)  # ('1', 2, [3, 4])

a, b, c = doSomething()
print(a)  # 1
print(b)  # 2
print(c)  # [3, 4]

rs_none = doNothing()
print(rs_none == None)  # True
print(type(rs_none))  # NoneType

# 返回值


# 参数: 必备参数 | 可变参数 | 关键字参数 | 默认参数
# - 必备参数: 必须要传递的参数
def add(a, b, c):
    print(a, b, c)


# - 默认参数:
def minus(a, b=10, c=100):
    print(f"a, b, c is {a,b,c}")  # a, b, c is (1, 10, 100)


minus(1)


# - 可变参数: 可以传递任意多个参数, 以元组的形式出现
def multiple(a, *args):
    print(a)  # 1
    print(args)  # (2, 3, 4, 5)


multiple(1, 2, 3, 4, 5)


# - 关键字参数: 可以传递任意多个参数, 以字典的形式出现
def keyword(a, **kwargs):
    print(a, kwargs)  # 1 {'name': 'leslie', 'age': 19}


keyword(1, name="leslie", age=19)


# 函数嵌套定义
def study():
    print("Study hard 1")

    def course():
        print("Python")

    course()

    print("Study hard 2")


study()
